﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Threading;
using System.Globalization;

namespace OpenBlog.Web
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {

        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            try
            {
                if (Request.Cookies["LNG"] == null || Request.Cookies["LNG"].Value == string.Empty)
                {
                    Thread.CurrentThread.CurrentCulture = new CultureInfo(ConfigurationSettings.AppSettings["DefaultLNG"]);
                }
                else
                {
                    Thread.CurrentThread.CurrentCulture = new CultureInfo(Request.Cookies["LNG"].Value);
                }
            }
            catch (Exception)
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo(ConfigurationSettings.AppSettings["DefaultLNG"]);
            }
            finally
            {
                Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
            }
        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}